import {request} from "@/api";
import type {Article} from "@/api/article/params";

// 获取文章分类
function getCategoryList() {
    return request({
        url: '/system/category/list',
        method: 'get',
    })
}


// 文章列表
function articleList(id: string) {
    return request({method: 'get', url: `/system/article/list?categoryId=${id}`})
}
// 获取文章详情
function getArticleDetail(id: string) {
    return request({
        url: `/system/article/${id}`,
        method: 'get',
    })
}
// 取消收藏
function unfavorite(id){
    return request({
        url: `/system/collect/${id}`,
        method: 'delete',
    })
}
// 收藏
function addCollect(data:any){
    return request({
        url: `/system/collect`,
        method: 'post',
        data
    })
}
export {getCategoryList, articleList,getArticleDetail,unfavorite,addCollect}